﻿//--------------------------------------------------------------------------------------------------------------------- 
// <copyright file="WriteFile.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights reserved.
// </copyright>
// <summary>
//   Defines the WriteFile type.
// </summary>
//---------------------------------------------------------------------------------------------------------------------
namespace Collaboris.Saf.Tests.Support.Actions
{
    using Engine;

    using Entities;

    /// <summary>
    /// </summary>
    public class CalculatorAction : ActionBase<Calculator>
    {
        public int FinalResult
        {
            get;
            set;
        }
        
        /// <summary>
        /// Code to run the Action
        /// </summary>
        /// <returns></returns>
        protected override ProcessStatus DoAction(SafContext context, Calculator props)
        {
            this.Trace.TraceMethodStart("DoAction");

            // Result is an output param
            props.Result = props.FirstNumber + props.SecondNumber;
            
            this.Trace.TraceMethodEnd("DoAction");

            // Successful Result, lets continue processing the 
            // next Actions (if any).
            return ProcessStatus.Success;
        }

        protected override ProcessStatus UndoAction(SafContext context, Calculator props)
        {
            // Successful Result, lets continue processing the 
            // Previous Actions (if any).
            return ProcessStatus.Success;
        }
    }
}